﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;


namespace SpecialEffects
{
    /// <summary>
    /// This class struct represents a vertex of the BasicExplosion.
    /// </summary>
    public struct VertexExplosion
    {
        public Vector3 position
        {
            get;
            set;
        }

        public Vector3 objectDirection
        {
            get;
            set;
        }

        public Vector3 randomDirection
        {
            get;
            set;
        }

        public Vector2 texCoord
        {
            get;
            set;
        }

        /// <summary>
        /// The time when the special effect was created.
        /// </summary>
        public float birthTime
        {
            get;
            set;
        }

        /// <summary>
        /// The maximum lifetime of a special effect.
        /// </summary>
        public float maxTime
        {
            get;
            set;
        }

        public float randomValue
        {
            get;
            set;
        }

        /// <summary>
        /// Total size of the whole effect.
        /// </summary>
        public float totalSize
        {
            get;
            set;
        }

        public float particleSize
        {
            get;
            set;
        }

        /// <summary>
        /// The constructor of this class struct.
        /// </summary>
        public VertexExplosion(Vector3 position, Vector3 objectDirection, Vector3 randomDirection, Vector2 texCoord, float birthTime, float maxTime, float randomValue, float totalSize, float particleSize) : this()
        {
            this.position = position;
            this.objectDirection = objectDirection;
            this.randomDirection = randomDirection;
            this.texCoord = texCoord;
            this.birthTime = birthTime;
            this.maxTime = maxTime;
            this.randomValue = randomValue;
            this.totalSize = totalSize;
            this.particleSize = particleSize;
        }

        public static readonly VertexDeclaration vertexDeclaration = new VertexDeclaration
            (new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
             new VertexElement(sizeof(float) * 3, VertexElementFormat.Vector3, VertexElementUsage.TextureCoordinate, 0),
             new VertexElement(sizeof(float) * (3 + 3), VertexElementFormat.Vector3, VertexElementUsage.TextureCoordinate, 1),
             new VertexElement(sizeof(float) * (3 + 3 + 3), VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 2),
             new VertexElement(sizeof(float) * (3 + 3 + 3 + 2), VertexElementFormat.Single, VertexElementUsage.TextureCoordinate, 3),
             new VertexElement(sizeof(float) * (3 + 3 + 3 + 2 + 1), VertexElementFormat.Single, VertexElementUsage.TextureCoordinate, 4),
             new VertexElement(sizeof(float) * (3 + 3 + 3 + 2 + 1 + 1), VertexElementFormat.Single, VertexElementUsage.TextureCoordinate, 5),
             new VertexElement(sizeof(float) * (3 + 3 + 3 + 2 + 1 + 1 + 1), VertexElementFormat.Single, VertexElementUsage.TextureCoordinate, 6),
             new VertexElement(sizeof(float) * (3 + 3 + 3 + 2 + 1 + 1 + 1 + 1), VertexElementFormat.Single, VertexElementUsage.TextureCoordinate, 7));

    }
}

